package com.qyl.honghengshop.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.qyl.honghengshop.dao.GoodsTypeDao;
import com.qyl.honghengshop.dao.impl.GoodsTypeDaoImpl;
import com.qyl.honghengshop.dto.GoodTypeManager;
import com.qyl.honghengshop.dto.Goods_type;
import com.qyl.honghengshop.service.GoodsTypeService;
import com.qyl.honghengshop.utils.PageBean;

public class GoodsTypeServiceImpl implements GoodsTypeService {

	private GoodsTypeDao shopTypeDao = new GoodsTypeDaoImpl();
	
	@Override
	public int getRecordCount(Goods_type goods_type) {

		return shopTypeDao.getRecordCount(goods_type);
	}

	@Override
	public void shopTypeList(PageBean pageBean,Goods_type goods_type) {

		shopTypeDao.shopTypeList(pageBean,goods_type);
		
	}

	@Override
	public List<Goods_type> getShopTypeAjax() {

		return shopTypeDao.getShopTypeAjax();
	}

	@Override
	public int add(Goods_type goods_type) {
	
		return shopTypeDao.add(goods_type);
	}

	@Override
	public int delShopType(String code) {

		return shopTypeDao.delShopType(code);
	}

	@Override
	public Goods_type getShopTypeByCode(String code) {

			
		return shopTypeDao.getShopTypeByCode(code);
	}

	@Override
	public int update(Goods_type goods_type) {
		
		return shopTypeDao.update(goods_type);
	}

	public GoodTypeManager getGoodTypeManger(){
		
		GoodTypeManager goodTypeManager = new GoodTypeManager();
		
		List<Map<String, String>> maxGoodTypes = shopTypeDao.getMaxGoodTypes();
		
		List<Map<String, String>> minGoodTypes = shopTypeDao.getMinGoodTypes("");
		
		goodTypeManager.setMaxGoodType(maxGoodTypes);
		
		goodTypeManager.setMinGoodType(minGoodTypes);
		
		return goodTypeManager;
		
	}
	
	
	

}
